#include "window.hpp"
#include "scene.hpp"
#include "view.hpp"

#include "GL/glut.h"

int wHeight, wWidth;

void reshapeCallback(int width, int height) {
    if (height == 0) height = 1;
    wHeight = height;
    wWidth = width;
    updateView();
}

void idleCallback() {
    glutPostRedisplay();
}

void initWindow(void){
    glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE);
    glutInitWindowSize(SCR_WIDTH, SCR_HEIGHT);
    glutCreateWindow("InfiniFactory Demo");
    glutDisplayFunc(redrawCallback);
    glutReshapeFunc(reshapeCallback);
    glutKeyboardFunc(keyboardCallback);
	glutSetCursor(GLUT_CURSOR_CROSSHAIR);
    glutMouseFunc(mouseKeyCallback);
    // glutMotionFunc(mouseMotionCallback);
    glutPassiveMotionFunc(mouseMotionCallback);
    glutIdleFunc(idleCallback);
    glutMainLoop();
}